{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "D\n"
     ]
    }
   ],
   "source": [
    "score = int(input('请输入一个整数： '))\n",
    "if score > 100 or score < 0:\n",
    "    print('wrong score.must between 0 and 100.')\n",
    "elif score >= 90:\n",
    "    print('A')\n",
    "elif score >= 80:\n",
    "    print('B')\n",
    "elif score >=70:\n",
    "    print('c')\n",
    "elif score >=60:\n",
    "    print('D')\n",
    "else:\n",
    "    print('E')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C\n"
     ]
    }
   ],
   "source": [
    "score = int(input('请输入一个整数： '))\n",
    "degree = 'DCBAAF'\n",
    "if score >100 or score < 0:\n",
    "    print('wrong score.must between 0 and 100.')\n",
    "else:\n",
    "    index = (score - 60) // 10\n",
    "    if index >= 0:\n",
    "        print(degree[index])\n",
    "    else:\n",
    "        print(degree[-1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "7\n",
      "14\n",
      "21\n",
      "28\n",
      "42\n",
      "49\n",
      "56\n",
      "63\n",
      "77\n",
      "84\n",
      "91\n",
      "98\n"
     ]
    }
   ],
   "source": [
    "for i in range(1,101):\n",
    "    if i%7==0 and i%5!=0:\n",
    "        print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1*1=1 \n",
      "2*1=2 2*2=4 \n",
      "3*1=3 3*2=6 3*3=9 \n",
      "4*1=4 4*2=8 4*3=12 4*4=16 \n",
      "5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 \n",
      "6*1=6 6*2=12 6*3=18 6*4=24 6*5=30 6*6=36 \n",
      "7*1=7 7*2=14 7*3=21 7*4=28 7*5=35 7*6=42 7*7=49 \n",
      "8*1=8 8*2=16 8*3=24 8*4=32 8*5=40 8*6=48 8*7=56 8*8=64 \n",
      "9*1=9 9*2=18 9*3=27 9*4=36 9*5=45 9*6=54 9*7=63 9*8=72 9*9=81 \n"
     ]
    }
   ],
   "source": [
    "for i in range(1,10):\n",
    "    for j in range(1,i+1):\n",
    "        print('{0}*{1}={2}'.format(i,j,i*j),end=' ')\n",
    "    print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                  \n",
      "        *         \n",
      "       * *        \n",
      "      * * *       \n",
      "     * * * *      \n",
      "    * * * * *     \n",
      "   * * * * * *    \n",
      "    * * * * *     \n",
      "     * * * *      \n",
      "      * * *       \n",
      "       * *        \n",
      "        *         \n"
     ]
    }
   ],
   "source": [
    "n = int(input('请输入一个整数: '))\n",
    "for i in range(n):\n",
    "    print(('* '*i).center(n*3))\n",
    "\n",
    "for i in range(n, 0, -1):\n",
    "    print(('* '*i).center(n*3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1, 24)\n"
     ]
    }
   ],
   "source": [
    "def demo(s):\n",
    "    result = [0,0]\n",
    "    for ch in s:\n",
    "        if ch.islower():\n",
    "            result[1] +=1\n",
    "        elif ch.isupper():\n",
    "            result[0] += 1\n",
    "    return tuple(result)\n",
    "\n",
    "print(demo('Beautifui is better than ugly.'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def yanghui(t):\n",
    "    print([1])\n",
    "    linr = [1,1]\n",
    "    print(line)\n",
    "    for i in range(2,t):\n",
    "        r = []\n",
    "        for j in range(0,len(line)-1):\n",
    "            r.append(line[j]+line[j+1])\n",
    "        line = [1] + r + [1]\n",
    "        print(line)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
